const getElement = function(id) {
	return new Promise((res) => {
		let view = uni.createSelectorQuery().select(id);
		view.fields({
			size: true
		}, data => {
			if (data == null) {
				console.log(id + "data is null")
				return
			}
			res(data)
		}).exec();
	})
}
const boundingClientRect = function(that,id) {
	return new Promise((res) => {
		const query = uni.createSelectorQuery().in(that);
		query.select(id).boundingClientRect(data => {
			// console.log("得到布局位置信息" + JSON.stringify(data));
			// console.log("节点离页面顶部的距离为" + data.top);
			res(data)
		}).exec();
	})
}

export default {
	getElement,
	boundingClientRect
}
